import store from '@/store'
/**
 * Created by PanJiaChen on 16/11/18.
 */

/**
 * @param {string} path
 * @returns {Boolean}
 */
export function isExternal(path) {
  return /^(https?:|mailto:|tel:)/.test(path)
}

/**
 * @param {string} str
 * @returns {Boolean}
 */
export function validMobile(str) {
  return /^1[3-9]\d{9}$/.test(str)
}

/**
 * @param {string} str
 * @returns {Boolean}
 */

export function validDpt(str, type) {
  const data = store.state.departments.data.depts
  return !data.find(item => item[type] === str)
}
